<template>
	<el-drawer title="询价单详情" v-model="visible" :size="800" destroy-on-close @closed="$emit('closed')">
		<el-container v-loading="loading">
			<el-main>
				<el-form>
					<el-form-item label="询价单标题" prop="title">{{ form.title }}
					</el-form-item>
					<el-row :gutter="24">
						<el-col :lg="12">
							<el-form-item label="询价单号" prop="inquiryCode">{{ form.inquiryCode }}
							</el-form-item>
						</el-col>
						<el-col :lg="12">
							<el-form-item label="结算币种" prop="cashType">{{ form.cashTypeName }}
							</el-form-item>
						</el-col>
					</el-row>
					<el-row :gutter="24">
						<el-col :lg="12">
							<el-form-item label="客户名称" prop="customerId">{{ form.cnName }}
							</el-form-item>
						</el-col>
						<el-col :lg="12">
							<el-form-item label="支付方式" prop="payType">{{ form.payTypeName}}
							</el-form-item>
						</el-col>
					</el-row>
					<el-row :gutter="24">
						<el-col :lg="12">
							<el-form-item label="联系人" prop="linkMan">{{ form.linkMan }}
							</el-form-item>
						</el-col>
						<el-col :lg="12">
							<el-form-item label="联系电话" prop="tel">{{ form.tel }}
							</el-form-item>
						</el-col>
					</el-row>
					<el-divider content-position="center">询价明细</el-divider>
					<scTable :data="mx" drag-sort>
						<el-table-column prop="productName" label="产品名称" width="200"></el-table-column>
						<el-table-column prop="materialCode" label="产品编码" width="150" :show-overflow-tooltip="true"></el-table-column>
						<el-table-column prop="model" label="产品型号" width="100" align="center" :show-overflow-tooltip="true"></el-table-column>
						<el-table-column prop="count" label="数量" width="50"></el-table-column>
						<el-table-column prop="unit" label="单位" width="50" align="center"></el-table-column>
						<el-table-column prop="delivery" label="交货期" width="150" align="center"></el-table-column>
						<el-table-column prop="remark" label="备注" align="center" :show-overflow-tooltip="true"></el-table-column>
					</scTable>
					<el-row :gutter="24" style="margin-top: 10px;">
						<el-col :lg="12">
							<el-form-item label="报价时间" prop="endTime">{{ form.endTime }}
							</el-form-item>
						</el-col>
						<el-col :lg="12">
							<el-form-item label="送货地址" prop="sendAdd">{{ form.sendAdd }}
							</el-form-item>
						</el-col>
					</el-row>
					<el-row :gutter="24">
						<el-col :lg="12">
							<el-form-item label="客户性质" prop="customerNature">
								<el-tag type="success" size="small" v-if="form.customerNature==='0'">合作伙伴</el-tag>
								<el-tag type="danger" size="small" v-else-if="form.customerNature==='1'">终端用户</el-tag>
							</el-form-item>
						</el-col>
						<el-col :lg="12">
							<el-form-item label="包装要求" prop="packCharges">
								<el-tag type="success" size="small" v-if="form.packCharges==='0'">不需要包装</el-tag>
								<el-tag type="danger" size="small" v-else-if="form.packCharges==='1'">需要包装</el-tag>
							</el-form-item>
						</el-col>
					</el-row>
					<el-row :gutter="24">
						<el-col :lg="12">
							<el-form-item label="是否含税" prop="taxFlag">
								<el-tag type="success" size="small" v-if="form.taxFlag==='0'">不含税</el-tag>
								<el-tag type="danger" size="small" v-else-if="form.taxFlag==='1'">含税</el-tag>
							</el-form-item>
						</el-col>
						<el-col :lg="12">
							<el-form-item label="是否开票" prop="invoiceFlag">
								<el-tag type="success" size="small" v-if="form.invoiceFlag==='0'">不开票</el-tag>
								<el-tag type="danger" size="small" v-else-if="form.invoiceFlag==='1'">开票</el-tag>
							</el-form-item>
						</el-col>
					</el-row>
					<el-form-item label="询价备注">{{ form.remark }}
					</el-form-item>
					<el-form-item label="相关附件" v-if="form.attachId!=''">
						<attach-menu :attachIds="form.attachId" :roleFlag="3" :preview="true" ></attach-menu>
					</el-form-item>
				</el-form>
				<el-footer style="text-align: center;">
					<el-button @click="visible=false">关闭</el-button>
				</el-footer>
			</el-main>
		</el-container>
	</el-drawer>
</template>

<script>
import AttachMenu from '@/views/module/attachMenu'

export default {
	emits: ['success', 'closed'],
	components: {
		AttachMenu
	},
	data() {
		return {
			loading: false,
			form: {
				inquiryId: '',
				title: '',
				inquiryCode: '',
				cashTypeName: '',
				cnName: '',
				payTypeName: '',
				linkMan: '',
				tel: '',
				formJson: "",
				endTime: '',
				sendAdd: '',
				customerNature: '1',
				packCharges: '1',
				taxFlag: '1',
				invoiceFlag:'1',
				remark:"",
				attachId:""
			},
			visible: false,
			isSaveing: false,
		}
	},
	mounted() {

	},
	methods: {
		//显示
		open(model) {
			this.model = model;
			this.visible = true;
			return this;
		},
		//表单注入数据
		setData(data) {
			this.form.inquiryId = data.inquiryId
			this.form.title = data.title
			this.form.inquiryCode = data.inquiryCode
			this.form.cashTypeName = data.cashTypeName
			this.form.cnName = data.cnName
			this.form.payTypeName = data.payTypeName
			this.form.linkMan = data.linkMan
			this.form.tel = data.tel
			this.form.formJson = data.formJson
			this.form.endTime = data.endTime
			this.form.sendAdd = data.sendAdd
			this.form.customerNature = data.customerNature
			this.form.packCharges = data.packCharges
			this.form.taxFlag = data.taxFlag
			this.form.invoiceFlag = data.invoiceFlag
			this.form.remark = data.remark
			this.form.attachId = data.attachId
			if(data.formJson!=undefined&&data.formJson!='')
			{
				this.mx = JSON.parse(data.formJson);
			}
		}
	}
}
</script>

<style>
</style>
